//
//  LSZTertiaryInterfaceManager.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/8/27.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZTertiaryInterfaceManager.h"

@implementation LSZTertiaryInterfaceManager
-(id)initWithTertiaryInterface:(NSArray *)array
{
    self = [super init];
    if (self) {
        self.arrayData = [[NSMutableArray alloc]init];
        NSMutableArray * arrayMut = [[NSMutableArray alloc]init];
        for (NSDictionary * diction in array) {
            LSZTertiaryInterfaceMg * mg = [[LSZTertiaryInterfaceMg alloc]init];
            mg.name = NullStringjudgment(NSStr(diction[@"name"]));
            mg.times = NullStringjudgment(NSStr(diction[@"times"]));
            if([NullStringjudgment(NSStr(diction[@"publishTime"])) containsString:@" "]) {
                NSArray *array = [NullStringjudgment(NSStr(diction[@"publishTime"])) componentsSeparatedByString:@" "]; //从字符A中分隔成2个元素的数组
                mg.publishTime = array[0] ;
            }else{
                mg.publishTime = NullStringjudgment(NSStr(diction[@"publishTime"]));
            }
            mg.id_id = NullStringjudgment(NSStr(diction[@"id"]));
            mg.contentUrl = [NSString stringWithFormat:@"%@%@",URLTotalWeb,NullStringjudgment(NSStr(diction[@"contentUrl"]))];
            if ([[diction allKeys] containsObject:@"coverUrl"]) {
                mg.coverUrl =[NSString stringWithFormat:@"%@%@",URLTotalWeb,NullStringjudgment(NSStr(diction[@"coverUrl"]))];// NullStringjudgment(NSStr(diction[@"coverUrl"]));
            } if ([[diction allKeys] containsObject:@"summary"]) {
                mg.summary = NullStringjudgment(NSStr(diction[@"summary"]));
            }if ([[diction allKeys] containsObject:@"sortIndex"]) {
                mg.sortIndex = NullStringjudgment(NSStr(diction[@"sortIndex"]));
            }if ([[diction allKeys] containsObject:@"counts"]) {
                mg.counts = NullStringjudgment(NSStr(diction[@"counts"]));
            }
            
            [arrayMut addObject:mg];
        }
        self.arrayData = arrayMut;
    }
    return self;
}
@end
@implementation LSZTertiaryInterfaceMg
@end

